<template>
  <div>
    <el-dialog :title="title" :close-on-click-modal="false" v-dialogDrag :visible.sync="visible">
      <el-steps :active="active" align-center>
        <el-step title="基本信息"></el-step>
        <el-step title="出售信息"></el-step>
        <el-step title="其他信息"></el-step>
      </el-steps>
      <br />
      <el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"
        :disabled="method==='view'" label-width="120px">
        <el-row :gutter="15">
          <div v-show="active==1" style="margin-top: 20px;">
            <el-col :span="12">
              <el-form-item label="发布人" prop="user.id" :rules="[{ required: true, message: '请选择发布人', trigger: 'blur' }
                      ]">
                <GridSelect title="选择发布人" labelName='phone' labelValue='id' :value="inputForm.user.id" :limit="1"
                  @getValue='(value,item) => {inputForm.user.id=value,inputForm.phone=item[0].phone,inputForm.shopId=item[0].shopId}' :columns="[
                  {
                    prop: 'id',
                    label: '主键'
                  },
                  {
                    prop: 'phone',
                    label: '手机号(账号唯一)'
                  },
                  {
                    prop: 'nikeName',
                    label: '昵称'
                  }
                  ]" :searchs="[
                  {
                    prop: 'phone',
                    label: '手机号(账号唯一)'
                  }
                  ]" dataListUrl="/userinfo/tUserInfo/list" entityBeanName="tUserInfo"
                  queryEntityUrl="/userinfo/tUserInfo/queryById">
                </GridSelect>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="标题" prop="title" :rules="[
                    { required: true, message: '请输入房源名称', trigger: 'blur' }
                  ]">
                <el-input v-model="inputForm.title" placeholder="请填写标题"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="房源类型" prop="type" :rules="[{ required: true, message: '请选择房源类型', trigger: 'blur' }
                   ]">
                <el-select v-model="inputForm.type" placeholder="请选择房源类型" size="small" style="width: 100%;">
                  <el-option v-for="item in valueList" v-if="item.type==1" :key="item.valueNum" :label="item.valueName"
                    :value="item.valueNum">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="新房二手" prop="newOld" :rules="[
                  ]">
                <el-radio v-model="inputForm.newOld" label="1">新房</el-radio>
                <el-radio v-model="inputForm.newOld" label="2">二手房</el-radio>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="区域" prop="region" :rules="[{ required: true, message: '请选择区域', trigger: 'blur' }
                 ]">
                <el-select v-model="inputForm.region" placeholder="请选择区域" size="small" style="width: 100%;">
                  <el-option v-for="item in valueList" v-if="item.type==7" :key="item.valueName" :label="item.valueName"
                    :value="item.valueName">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12" v-if="inputForm.type==1">
              <el-form-item label="小区名称" prop="cellName" :rules="[ 
                 ]">
                <el-input v-model="inputForm.cellName" placeholder="请填写小区名称"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="地址" prop="address" :rules="[{ required: true, message: '请填写地址', trigger: 'blur' }
                 ]">
                <el-input v-model="inputForm.address" ref="handleinput" id="handleinput" placeholder="请填写地址"></el-input>
              </el-form-item>
            </el-col>

            <el-col :span="12" v-if="inputForm.type==1">
              <el-form-item label="朝向" prop="orientation" :rules="[
                ]">
                <el-select v-model="inputForm.orientation" placeholder="请选择朝向" size="small" style="width: 100%;">
                  <el-option v-for="item in valueList" v-if="item.type==22" :key="item.valueName" :label="item.valueName"
                    :value="item.valueName">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12" v-if="inputForm.type==1">
              <el-form-item label="房屋年限" prop="housingYearsList" :rules="[
                 ]">
                <el-select v-model="housingYearsList" multiple placeholder="请选择房屋年限" size="small" style="width: 100%;">
                  <el-option v-for="item in valueList" v-if="item.type==23" :key="item.valueName" :label="item.valueName"
                    :value="item.valueName">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="24" v-if="inputForm.type==1">
              <el-form-item label="产权类型" prop="propertyType" :rules="[
                 ]">
               <el-select v-model="inputForm.propertyType" placeholder="请选择产权类型" size="small" style="width: 100%;">
                  <el-option v-for="item in valueList" v-if="item.type==24" :key="item.valueName" :label="item.valueName"
                    :value="item.valueName">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="经度" prop="longitude" :rules="[
                 ]">
                <el-input v-model="inputForm.longitude" disabled placeholder="请填写经度"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="纬度" prop="latitude" :rules="[
                 ]">
                <el-input v-model="inputForm.latitude" disabled placeholder="请填写纬度"></el-input>
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="地图" prop="">
                <div ref="container" id="containepic"></div>
              </el-form-item>
            </el-col>

          </div>

          <div v-show="active==2" style="margin-top: 20px;">
            <el-col :span="12">
              <el-form-item label="售价" prop="price" :rules="[{ required: true, message: '请填写租金', trigger: 'blur' }
                    ]">
                <el-input v-model="inputForm.price" placeholder="请填写租金"></el-input>
              </el-form-item>
            </el-col>
            <!-- <el-col :span="12" v-if="inputForm.type==1">
            <el-form-item label="出租方式" prop="rentalMode"
                :rules="[ 
                 ]">
                 <el-select v-model="inputForm.rentalMode" placeholder="请选择出租方式" size="small" style="width: 100%;">
                  <el-option
                    v-for="item in valueList" v-if="item.type==2"
                    :key="item.valueName"
                    :label="item.valueName"
                    :value="item.valueName">
                  </el-option>
                </el-select>
           </el-form-item>
        </el-col> -->
            <!-- <el-col :span="12" v-if="inputForm.rentalMode =='合租'">
            <el-form-item label="出租房间" prop="rentRoom"
                :rules="[
                 ]">
                 <el-select v-model="inputForm.rentRoom" placeholder="请选择出租房间" size="small" style="width: 100%;">
                  <el-option
                    v-for="item in valueList" v-if="item.type==14"
                    :key="item.valueName"
                    :label="item.valueName"
                    :value="item.valueName">
                  </el-option>
                </el-select>
           </el-form-item>
        </el-col> -->
            <!-- <el-col :span="12" v-if="inputForm.type != 1">
            <el-form-item label="起租期" prop="startRent"
                :rules="[
                 ]">
              <el-input v-model="inputForm.startRent" placeholder="请填写起租期"     ></el-input>
           </el-form-item>
        </el-col> -->
            <!-- <el-col :span="12" v-if="inputForm.type == 1">
            <el-form-item label="付款方式" prop="paymentMethod"
                :rules="[{ required: true, message: '请选择付款方式', trigger: 'blur' }
                 ]">
                 <el-select v-model="inputForm.paymentMethod" placeholder="请选择付款方式" size="small" style="width: 100%;">
                  <el-option
                    v-for="item in valueList" v-if="item.type==11"
                    :key="item.valueName"
                    :label="item.valueName"
                    :value="item.valueName">
                  </el-option>
                </el-select>
           </el-form-item>
        </el-col> -->
            <el-col :span="12" v-if="inputForm.type == 1">
              <el-form-item label="户型" prop="houseType" :rules="[
                ]">
                <el-select v-model="inputForm.houseType" placeholder="请填写户型" size="small" style="width: 100%;">
                  <el-option v-for="item in valueList" v-if="item.type==3" :key="item.valueName" :label="item.valueName"
                    :value="item.valueName">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12" v-if="inputForm.type == 1">
              <el-form-item label="年代" prop="years" :rules="[
                 ]">
                <el-select v-model="inputForm.years" placeholder="请填写年代" size="small" style="width: 100%;">
                  <el-option v-for="item in valueList" v-if="item.type==6" :key="item.valueName" :label="item.valueName"
                    :value="item.valueName">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item :label="inputForm.type == 4 ? '厂区面积' : '面积m²'" prop="area" :rules="[{ required: true, message: '请填写面积', trigger: 'blur' }
                 ]">
                <el-input v-model="inputForm.area" placeholder="请填写面积"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12" v-if="inputForm.type == 4">
              <el-form-item label="车间面积" prop="workshopArea" :rules="[
                 ]">
                <el-input v-model="inputForm.workshopArea" placeholder="请填写车间面积"></el-input>
              </el-form-item>
            </el-col>
            <!-- <el-col :span="12" v-if="inputForm.type != 4 && inputForm.type != 5  && inputForm.type != 6">
              <el-form-item label="楼层类型" prop="floorType" :rules="[
                  ]">
                <el-radio v-model="floorType" label="1">单层</el-radio>
                <el-radio v-model="floorType" label="2">多层</el-radio>
                <el-radio v-model="floorType" label="3">独栋</el-radio>
              </el-form-item>
            </el-col> -->
            <el-col :span="12" v-if="inputForm.type != 4 && inputForm.type != 5 && inputForm.type != 6">
              <el-form-item label="楼层" prop="floor" :rules="[
                 ]">
                <el-input  style="width: 50px;" v-model="floorOne"></el-input><span>层</span>
                <!-- <span v-if="floorType==2">至</span> -->
                <!-- <el-input v-if="floorType==2" style="width: 50px;" v-model="floor2"></el-input><span
                  v-if="floorType==2">层</span> -->
                共<el-input style="width: 50px;" v-model="floorTwo"></el-input>层
              </el-form-item>
              <div v-if="floorType != ''" style="color:red;margin-left:120px;">
                   <span v-if="floorType == 1">单层:</span> 
                   <span v-if="floorType == 2">复式:</span> 
                   <span v-if="floorType == 3">独栋:</span> 
                  <span v-if="floorType == 1">{{floor1}}层，共{{floor3}}层</span> 
                   <span v-if="floorType == 2">{{floor1}}至{{floor2}}层，共{{floor3}}层</span> 
                   <span v-if="floorType == 3">共{{floor3}}层</span> 
              </div>
            </el-col>
            <el-col :span="12" v-if="inputForm.type != 1">
              <el-form-item label="使用状态" prop="useStatus" :rules="[
              ]">
                <el-radio v-model="inputForm.useStatus" label="1">闲置</el-radio>
                <el-radio v-model="inputForm.useStatus" label="2">经营中</el-radio>
              </el-form-item>
            </el-col>
            <!-- <el-col :span="12" v-if="inputForm.type == 1">
            <el-form-item label="起租日期" prop="startRentDate"
                :rules="[
                 ]">
                 <el-date-picker type="date" placeholder="选择日期" value-format="yyyy-MM-dd" v-model="inputForm.startRentDate" style="width: 100%;"></el-date-picker>
           </el-form-item>
        </el-col> -->
            <el-col :span="12" v-if="inputForm.type == 5">
              <el-form-item label="土地使用期限" prop="useTerm" :rules="[
               ]">
                共<el-input style="width: 50px;" v-model="useTerm2"></el-input><span>年</span>
                剩<el-input style="width: 50px;" v-model="useTerm1"></el-input>年
              </el-form-item>
            </el-col>
            <el-col :span="12" v-if="inputForm.type == 5">
              <el-form-item label="性质" prop="nature" :rules="[
                 ]">
                <el-select v-model="inputForm.nature" placeholder="请选择性质" size="small" style="width: 100%;">
                  <el-option v-for="item in valueList" v-if="item.type==15" :key="item.valueName"
                    :label="item.valueName" :value="item.valueName">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12" v-if="inputForm.type == 1">
              <el-form-item label="装修" prop="renovation" :rules="[
              ]">
                <el-select v-model="inputForm.renovation" placeholder="请选择装修" size="small" style="width: 100%;">
                  <el-option v-for="item in valueList" v-if="item.type==4" :key="item.valueName" :label="item.valueName"
                    :value="item.valueName">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12" v-if="inputForm.type == 1">
              <el-form-item label="电梯" prop="elevator" :rules="[
                 ]">
                <el-radio v-model="inputForm.elevator" label="有">有</el-radio>
                <el-radio v-model="inputForm.elevator" label="无">无</el-radio>
              </el-form-item>
            </el-col>
            <el-col :span="12" v-if="inputForm.type != 4||inputForm.type != 6">
              <el-form-item label="电梯" prop="garage" :rules="[
                 ]">
                 <el-radio v-model="inputForm.garage" label="无">无</el-radio>
                <el-radio v-model="inputForm.garage" label="车库">车库</el-radio>
                <el-radio v-model="inputForm.garage" label="车位">车位</el-radio>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="联系方式" prop="phone" :rules="[
                 ]">
                <el-input v-model="inputForm.phone" disabled placeholder="请填写联系方式"></el-input>
              </el-form-item>
            </el-col>
            <!-- <el-col :span="24" v-if="inputForm.type == 1">
          <el-form-item label="附属家具" prop="furniture"
              :rules="[
               ]">
               <el-checkbox-group v-model="inputForm.furniture">
                <el-checkbox 
                   v-for="item in valueList" v-if="item.type==5"
                   :name="type"
                  :label="item.valueName"
                  :value="item.valueName"></el-checkbox> 
              </el-checkbox-group>
         </el-form-item>
      </el-col> -->
          </div>

          <div v-show="active==3" style="margin-top: 20px;">
            <el-col :span="24">
              <el-form-item label="列表展示图" prop="displayDiagram" :rules="[
                 ]">
                <el-upload ref="displayDiagram" v-if="visible" list-type="picture-card"
                  :action="`${this.$http.BASE_URL}/sys/file/webupload/upload?uploadPath=/houseinfo/tHouseInfo`"
                  :headers="{token: $cookie.get('token')}" 


                  
                  :on-preview="(file, fileList) => {
                    showImg(inputForm.displayDiagram)
                    }"
                     :on-success="(response, file, fileList) => {
                       inputForm.displayDiagram = fileList.map(item => (item.response && item.response.url) || item.url).join('|')
                    }" :on-remove="(file, fileList) => {
                      $http.post(`/sys/file/webupload/deleteByUrl?url=${(file.response && file.response.url) || file.url}`).then(({data}) => {
                        $message.success(data.msg)
                      })
                      inputForm.displayDiagram = fileList.map(item => item.url).join('|')
                    }" :before-remove="(file, fileList) => {
                      return $confirm(`确定移除 ${file.name}？`)
                    }" multiple :limit="1" :on-exceed="(files, fileList) =>{
                      $message.warning(`当前限制选择 1 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`)
                    }" :file-list="displayDiagramArra">
                  <i class="el-icon-plus"></i>
                </el-upload>
              </el-form-item>
            </el-col>

            <el-col :span="24">
              <el-form-item label="房源图片" prop="houseImage" :rules="[
                 ]">
                <el-upload ref="houseImage" v-if="visible" list-type="picture-card"
                  :action="`${this.$http.BASE_URL}/sys/file/webupload/upload?uploadPath=/houseinfo/tHouseInfo`"
                  :headers="{token: $cookie.get('token')}" 
                  :on-preview="(file, fileList) => {
                    showImg(inputForm.houseImage)
                    }" :on-success="(response, file, fileList) => {
                       inputForm.houseImage = fileList.map(item => (item.response && item.response.url) || item.url).join('|')
                    }" :on-remove="(file, fileList) => {
                      $http.post(`/sys/file/webupload/deleteByUrl?url=${(file.response && file.response.url) || file.url}`).then(({data}) => {
                        $message.success(data.msg)
                      })
                      inputForm.houseImage = fileList.map(item => item.url).join('|')
                    }" :before-remove="(file, fileList) => {
                      return $confirm(`确定移除 ${file.name}？`)
                    }" multiple :limit="10" :on-exceed="(files, fileList) =>{
                      $message.warning(`当前限制选择 10 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`)
                    }" :file-list="houseImageArra">
                  <i class="el-icon-plus"></i>
                </el-upload>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="房源视频" prop="houseVideo" :rules="[
                
               ]">
                <el-upload ref="houseVideo" v-if="visible"
                  :action="`${this.$http.BASE_URL}/sys/file/webupload/upload?uploadPath=/thomemv/tHomeMv`"
                  :headers="{token: $cookie.get('token')}"
                  :on-preview="(file, fileList) => {
                    $window.location.href = (file.response && file.response.url) || file.url
                }"
                  :on-success="(response, file, fileList) => {
                     inputForm.houseVideo = fileList.map(item => (item.response && item.response.url) || item.url).join('|')
                  }" :on-remove="(file, fileList) => {
                    $http.post(`/sys/file/webupload/deleteByUrl?url=${(file.response && file.response.url) || file.url}`).then(({data}) => {
                      $message.success(data.msg)
                    })
                    inputForm.houseVideo = fileList.map(item => item.url).join('|')
                  }" :before-remove="(file, fileList) => {
                    return $confirm(`确定移除 ${file.name}？`)
                  }" :limit="1" :on-exceed="(files, fileList) =>{
                    $message.warning(`当前限制上传1个视频`)
                  }" :file-list="houseVideoArra">
                  <el-button size="small" type="primary">点击上传</el-button>
                </el-upload>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="户型图片" prop="houseTypeImage" :rules="[
                 ]">
                <el-upload ref="houseTypeImage" v-if="visible" list-type="picture-card"
                  :action="`${this.$http.BASE_URL}/sys/file/webupload/upload?uploadPath=/houseinfo/tHouseInfo`"
                  :headers="{token: $cookie.get('token')}" 
                  :on-preview="(file, fileList) => {
                    showImg(inputForm.houseTypeImage)
                    }" :on-success="(response, file, fileList) => {
                       inputForm.houseTypeImage = fileList.map(item => (item.response && item.response.url) || item.url).join('|')
                    }" :on-remove="(file, fileList) => {
                      $http.post(`/sys/file/webupload/deleteByUrl?url=${(file.response && file.response.url) || file.url}`).then(({data}) => {
                        $message.success(data.msg)
                      })
                      inputForm.houseTypeImage = fileList.map(item => item.url).join('|')
                    }" :before-remove="(file, fileList) => {
                      return $confirm(`确定移除 ${file.name}？`)
                    }" multiple :limit="10" :on-exceed="(files, fileList) =>{
                      $message.warning(`当前限制选择 10 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`)
                    }" :file-list="houseTypeImageArra">
                  <i class="el-icon-plus"></i>
                </el-upload>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="房源介绍" prop="houseIntroduce" :rules="[
                 ]">
                <el-input type="textarea" v-model="inputForm.houseIntroduce" placeholder="请填写房源介绍"></el-input>
              </el-form-item>
            </el-col>

            <!-- <el-col :span="12">
            <el-form-item label="出售出租状态" prop="status"
                :rules="[
                 ]">
              <el-input v-model="inputForm.status" placeholder="请填写出售出租状态"     ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="上架状态" prop="upStatus"
                :rules="[
                 ]">
              <el-input v-model="inputForm.upStatus" placeholder="请填写上架状态"     ></el-input>
           </el-form-item>
        </el-col> -->
            <!-- <el-col :span="12">
            <el-form-item label="是否首页显示" prop="isShow"
                :rules="[
                 ]">
              <el-input v-model="inputForm.isShow" placeholder="请填写是否首页显示"     ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="排序" prop="sort"
                :rules="[
                 ]">
              <el-input v-model="inputForm.sort" placeholder="请填写排序"     ></el-input>
           </el-form-item>
        </el-col> -->
            <el-col :span="24">
              <el-form-item label="备注信息" prop="remarks" :rules="[
                  ]">
                <el-input type="textarea" v-model="inputForm.remarks" placeholder="请填写备注信息"></el-input>
              </el-form-item>
            </el-col>
          </div>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button v-if="active !== 1" style="margin-top: 12px;" @click="upper">上一步</el-button>
       <el-button v-if="inputForm.examineStatus == 1" style="margin-top: 12px;"  @click="audit(inputForm.id,2,inputForm.user.id)">通过</el-button>
        <el-button v-if="inputForm.examineStatus == 1" style="margin-top: 12px;"  @click="jj(inputForm.id,3,inputForm.user.id)">拒绝</el-button>
        <el-button v-if="active !== 3" style="margin-top: 12px;" @click="next">下一步</el-button>
        <el-button @click="visible = false">关闭</el-button>
        <el-button type="primary" v-if="method != 'view'" @click="doSubmit()" v-noMoreClick>确定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
  import GridSelect from '@/components/gridSelect'
  export default {
    data() {
      return {
        displayDiagram:'',
        title: '',
        sysNo: localStorage.getItem('sysNo'),
        method: '',
        active: 1,
        visible: false,
        loading: false,
        valueList: [],
        displayDiagramArra:[],
        housingYearsList :[],
        houseImageArra: [],
        houseVideoArra: [],
        houseTypeImageArra: [],
        floorType: '',
        floor1: '',
        floor2: '',
        floor3: '',
        floorOne: '',
        floorTwo: '',
        useTerm1: '',
        useTerm2: '',
        inputForm: {
          id: '',
          title: '',
          shopId:'',
          user: {
            id: '',
            phone: '',
          },
          transactionType: '2',
          newOld: '1',
          useStatus: '1',
          type: '',
          region: '',
          cellName: '',
          address: '',
          longitude: '',
          latitude: '',
          price: '',
          rentalMode: '',
          rentRoom: '',
          paymentMethod: '',
          houseType: '',
          years: '',
          area: '',
          workshopArea: '',
          useTerm: '',
          floor: '',
          startRentDate: '',
          startRent: '',
          nature: '',
          renovation: '',
          elevator: '有',
          garage:'无',
          phone: '',
          houseImage: '',
          houseVideo: '',
          houseTypeImage: '',
          houseIntroduce: '',
          furniture: [],
          orientation:'',
          housingYears:'',
          propertyType:'',
          status: '',
          upStatus: '',
          isShow: '',
          sort: '',
          remarks: '',
          displayDiagram:'',
          examineStatus:''
        },
        markersArray: []
      }
    },
    components: {
      GridSelect
    },
    activated() {
      this.getvalueList()
    },
    methods: {
       showImg(imgStrList) {
       var imgList = imgStrList.split('|');
      this.$hevueImgPreview({
         multiple: true,
        nowImgIndex: 0,
        imgList: imgList
      })
    },
      // 获取数据列表
      getvalueList() {
        this.$http({
          url: '/valueinfo/tValueInfo/list',
          method: 'get',
          params: {
            'pageNo': 1,
            'pageSize': 999,
            'orderBy': this.orderBy,
            'type': '1,2,3,4,5,6,7,11,14,15,22,23,24'
          }
        }).then(({ data }) => {
          if (data && data.success) {
            this.valueList = data.page.list
          }
        })
      },
      next() {
        this.active++
      },
      upper() {
        this.active--
      },
      initMap(longitude, latitude) {
        var that = this;
        let address = "";
        let lat = "36.752508224779746";
        let logt = "119.97121810913086";
        if (!longitude) {
          let lat = latitude;
          let logt = longitude;
        }
        if (this.inputForm.latitude === '') {
          var center = new qq.maps.LatLng(lat, logt);
        } else {
          var center = new qq.maps.LatLng(this.inputForm.latitude, this.inputForm.longitude);
        }
        var map = new qq.maps.Map(document.getElementById("containepic"), {
          center: center,
          zoom: 13,
          disableDefaultUI: true,
        });
        var marker = new qq.maps.Marker({
          position: center,
          map: map,
        });
        that.markersArray.push(marker);
        var infoWin = new qq.maps.InfoWindow({
          map: map,
        }); //此处是点击地图后生成的地标名称
        var geocoder = new qq.maps.Geocoder({
          complete: function (res) {
            that.deleteOverlays();
            map.setCenter(res.detail.location);
            var marker = new qq.maps.Marker({
              map: map,
              position: res.detail.location,
            });
            that.markersArray.push(marker);
          },
        });

        qq.maps.event.addListener(map, "click", function (event) {
          that.deleteOverlays();
          this.latitude = event.latLng.getLat();
          this.longiistude = event.latLng.getLng();
          console.log(this.longiistude, this.latitude);
          that.inputForm.longitude = this.longiistude;
          that.inputForm.latitude = this.latitude;
          var position = new qq.maps.LatLng(that.inputForm.latitude, that.inputForm.longitude);
          var marker = new qq.maps.Marker({
            map: map,
            position: position
          });
          that.markersArray.push(marker);
        });
        document.getElementById("handleinput").addEventListener("blur", function () {
          console.log("1111");
          geocoder.getLocation(that.inputForm.address);
        });
      },
      deleteOverlays() {
        if (this.markersArray) {
          for (var i in this.markersArray) {
            this.markersArray[i].setMap(null);
          }
          this.markersArray.length = 0;
        }
      },
      init(method, id) {
        this.housingYearsList = []
        this.method = method
        this.active = 1
        this.inputForm.id = id
        this.floor1 = '';
        this.floor2 = '';
        this.floor3 = '';
        this.floorType= '';
        this.floorOne= '';
        this.floorTwo= '';
        if (method === 'add') {
          this.inputForm.furniture = []
          this.title = `新建房源`
        } else if (method === 'edit') {
          this.title = '修改房源'
        } else if (method === 'view') {
          this.title = '查看房源'
        }
        this.displayDiagramArra = []
        this.houseImageArra = []
        this.houseVideoArra = []
        this.houseTypeImageArra = []
        this.visible = true
        this.loading = false
        this.$nextTick(() => {
          this.$refs.inputForm.resetFields()
          if (method === 'edit' || method === 'view') { // 修改或者查看
            this.loading = true
            this.$http({
              url: `/houseinfo/tHouseInfo/queryById?id=${this.inputForm.id}`,
              method: 'get'
            }).then(({ data }) => {
              this.inputForm = this.recover(this.inputForm, data.tHouseInfo)
              if (data.tHouseInfo.furniture) {
                this.inputForm.furniture = data.tHouseInfo.furniture.split(",");
              }
              if (data.tHouseInfo.housingYears) {
                this.housingYearsList = this.inputForm.housingYears.split(",");
              }
              this.initMap(this.inputForm.longiistude, this.inputForm.latitude);
              if(this.inputForm.floor && this.inputForm.floor.indexOf("|") != -1){
                 var result = this.inputForm.floor.split("|");
                this.floorOne = result[0];
                this.floorTwo = result[1];
              } else {
                if (this.inputForm.floor) {
                  var result = this.inputForm.floor.split(",");
                  this.floorType = result[0];
                  if (this.floorType == 1) {//单层
                    this.floor1 = result[1];
                    this.floor3 = result[2];
                  }
                  if (this.floorType == 2) {//多层
                    this.floor1 = result[1];
                    this.floor2 = result[2];
                    this.floor3 = result[3];
                  }
                  if (this.floorType == 3) {//独栋 
                    this.floor3 = result[1];
                  }
                }
              }
              if (this.inputForm.useTerm) {
                var result = this.inputForm.useTerm.split(",");
                this.useTerm1 = result[0];
                this.useTerm2 = result[1];
              }
              if (this.inputForm.displayDiagram) {
                this.inputForm.displayDiagram.split('|').forEach((item) => {
                  if (item.trim().length > 0) {
                    this.displayDiagramArra.push({ name: decodeURIComponent(item.substring(item.lastIndexOf('/') + 1)), url: item })
                  }
                })
              }
              if (this.inputForm.houseImage) {
                this.inputForm.houseImage.split('|').forEach((item) => {
                  if (item.trim().length > 0) {
                    this.houseImageArra.push({ name: decodeURIComponent(item.substring(item.lastIndexOf('/') + 1)), url: item })
                  }
                })
              }
              if (this.inputForm.houseVideo) {
                this.inputForm.houseVideo.split('|').forEach((item) => {
                  if (item.trim().length > 0) {
                    this.houseVideoArra.push({ name: decodeURIComponent(item.substring(item.lastIndexOf('/') + 1)), url: item })
                  }
                })
              }
              if (this.inputForm.houseTypeImage) {
                this.inputForm.houseTypeImage.split('|').forEach((item) => {
                  if (item.trim().length > 0) {
                    this.houseTypeImageArra.push({ name: decodeURIComponent(item.substring(item.lastIndexOf('/') + 1)), url: item })
                  }
                })
              }
              this.loading = false
            })
          } else {
            this.initMap()
          }
        })
      },
      audit(id,examineStatus,userId) { 
        if (!userId){
          this.$message({
            type: 'info',
            message: '账号已注销，无需审核！'
          });  
          return 
        }
        this.$confirm(`确定当前操作?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.loading = true
          this.$http({
            url: '/houseinfo/tHouseInfo/audit',
            method: 'post',
            params: {'id': id,"examineStatus":examineStatus,'user.id':userId}
          }).then(({data}) => {
            if (data && data.success) {
              this.visible = false
              this.$emit('refreshDataList')
              this.$message.success(data.msg)
            }
            this.loading = false
          })
        })
      },
      jj(id,examineStatus,userId){
        if (!userId){
          this.$message({
            type: 'info',
            message: '账号已注销，无需审核！'
          });  
          return 
        }
        this.$prompt('请输入拒绝原因', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消'
        }).then(({ value }) => {
          if (!value){
              this.$message.error("请输入拒绝原因");
              return false
            }
          this.loading = true
          this.$http({
            url: '/houseinfo/tHouseInfo/audit',
            method: 'post',
            params: {'id': id,"examineStatus":examineStatus,'reason':value,'user.id':userId}
          }).then(({data}) => {
            if (data && data.success) {
              this.visible = false
              this.$emit('refreshDataList')
              this.$message.success(data.msg)
              this.loading = false
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '取消输入'
          })    
        })
      },
      // 表单提交
      doSubmit() {
        this.$refs['inputForm'].validate((valid) => {
          if (valid) {
            // if (this.floorType == 1) {//单层
            //   if (this.floor1 && this.floor3) {
            //     this.inputForm.floor = this.floorType + ',' + this.floor1 + ',' + this.floor3
            //   }
            // }
            // if (this.floorType == 2) {//多层
            //   if (this.floor1 && this.floor2 && this.floor3) {
            //     this.inputForm.floor = this.floorType + ',' + this.floor1 + ',' + this.floor3 + ',' + this.floor3
            //   }

            // }
            // if (this.floorType == 3) {//独栋 
            //   if (!this.floor3) {
            //     this.inputForm.floor = this.floorType + ',' + this.floor3;
            //   }
            // }
            if (this.floorOne && this.floorTwo) {
              this.inputForm.floor = this.floorOne + '|' + this.floorTwo
            }
            if (this.useTerm1 && this.useTerm2) {
              this.inputForm.useTerm = this.useTerm1 + ',' + this.useTerm2;
            }
            console.log(this.housingYearsList,1);
             if (this.housingYearsList) {
                this.inputForm.housingYears = this.housingYearsList.join(",");
            }
            this.inputForm.furniture = String(this.inputForm.furniture)
            this.loading = true
            this.$http({
              url: `/houseinfo/tHouseInfo/save`,
              method: 'post',
              data: this.inputForm
            }).then(({ data }) => {
              this.loading = false
              if (data && data.success) {
                this.visible = false
                this.$message.success(data.msg)
                this.$emit('refreshDataList')
              }
            })
          }
        })
      }
    }
  }
</script>
<style>
  #containepic {
    width: 750px;
    height: 500px;
  }
</style>
<style lang="less" scoped>
  .showPic .el-message-box__message{
      width: 800px;
      height: 800px;
      overflow: hidden;
      display: flex;
       p img {
        height: 100%!important;
        width: 100%!important;
        object-fit: contain;
      }
    }
    </style>